package friot.service.cloud.controller;

import friot.model.iot.entity.IotModel;
import friot.service.cloud.service.IotModelService;
import friot.utils.tools.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author He Kuntao
 * @desc Iot数据模型
 * @date 2024/2/20 15:18
 */
@RestController
@RequestMapping("/api/iot/model")
public class IotModelController {
    @Resource
    private IotModelService iotModelService;

    /**
     * 获取数据模型
     */
    @GetMapping
    public Result listDataModel() {
        return Result.success(iotModelService.list());
    }

    /**
     * 创建数据模型
     */
    @PostMapping
    public Result createDataModel(@RequestBody IotModel iotModel) {
        iotModelService.saveModel(iotModel);
        return Result.success(iotModelService.list());
    }


}
